home *** CD-ROM | disk | FTP | other *** search
/ Chip 2007 January, February, March & April / Chip-Cover-CD-2007-02.iso / Pakiet bezpieczenstwa / mini Pentoo LiveCD 2006.1 / mpentoo-2006.1.iso / livecd.squashfs / usr / include / ewl / ewl_container.h < prev    next >
C/C++ Source or Header  |  2006-01-09  |  7KB  |  167 lines

  1. #ifndef __EWL_CONTAINER_H__
  2. #define __EWL_CONTAINER_H__
  3.  
  4. /**
  5.  * @file ewl_container.h
  6.  * @defgroup Ewl_Container Container: Widgets Holding Other Widgets
  7.  * @brief Define the Ewl_Container class which inherits from Ewl_Widget and adds
  8.  * the ability to nest Ewl_Widget's inside.
  9.  *
  10.  * @{
  11.  */
  12.  
  13. /**
  14.  * This class inherits from Ewl_Widget and provides the capabilities necessary
  15.  * for nesting other widgets inside.
  16.  */
  17. typedef struct Ewl_Container Ewl_Container;
  18.  
  19. /**
  20.  * @def EWL_CONTAINER(widget)
  21.  * @brief Typecast a poiner to an Ewl_Container pointer.
  22.  */
  23. #define EWL_CONTAINER(widget) ((Ewl_Container *) widget)
  24.  
  25. /**
  26.  * A typedef to shorten the definition of the child_add callbacks. This
  27.  * callback is container specific and is triggered when an Ewl_Widget is added
  28.  * to the Ewl_Container.
  29.  */
  30. typedef void    (*Ewl_Child_Add) (Ewl_Container *c, Ewl_Widget *w);
  31.  
  32. /**
  33.  * A typedef to shorten the definition of the child_remove callbacks. This
  34.  * callback is container specific and is triggered when an Ewl_Widget is
  35.  * removed from the Ewl_Container.
  36.  */
  37. typedef void    (*Ewl_Child_Remove) (Ewl_Container *c, Ewl_Widget *w);
  38.  
  39. /**
  40.  * A typedef to shorten the definition of the child_resize callbacks. This
  41.  * callback is container specific and is triggered when an Ewl_Widget is
  42.  * resized in the Ewl_Container.
  43.  */
  44. typedef void    (*Ewl_Child_Resize) (Ewl_Container *c, Ewl_Widget *w,
  45.                      int size, Ewl_Orientation o);
  46.  
  47. /**
  48.  * A typedef to shorten the definition of the child_show callbacks. This
  49.  * callback is container specific and is triggered when an Ewl_Widget is shown
  50.  * to the Ewl_Container.
  51.  */
  52. typedef void    (*Ewl_Child_Show) (Ewl_Container *c, Ewl_Widget *w);
  53.  
  54. /**
  55.  * A typedef to shorten the definition of the child_hide callbacks. This
  56.  * callback is container specific and is triggered when an Ewl_Widget is hidden
  57.  * from the Ewl_Container.
  58.  */
  59. typedef void    (*Ewl_Child_Hide) (Ewl_Container *c, Ewl_Widget *w);
  60.  
  61. /**
  62.  * A typedef to shorten the definition of the child iterator callbacks. This
  63.  * callback is container specific and is usually set in the container's init
  64.  * function. This is used to pick the next child in the list of children for
  65.  * the container.
  66.  */
  67. typedef Ewl_Widget *(*Ewl_Container_Iterator) (Ewl_Container *c);
  68.  
  69. /**
  70.  * @struct Ewl_Container
  71.  * Inherits from the Ewl_Widget and expands to allow for placing child widgets
  72.  * within the available space. Also adds notifiers for various child events.
  73.  */
  74. struct Ewl_Container
  75. {
  76.     Ewl_Widget       widget; /**< Inherit the basics of the widget. */
  77.  
  78.     Ecore_List      *children; /**< List of children that are contained. */
  79.  
  80.     Evas_Object     *clip_box; /**< Clip box to bound widgets inside. */
  81.  
  82.     Ewl_Container   *redirect; /**< Alternate parent for children */
  83.  
  84.     Ewl_Child_Add    child_add; /**< Function called on child add */
  85.     Ewl_Child_Remove child_remove; /**< Function called on child remove */
  86.     Ewl_Child_Resize child_resize; /**< Function called on child resize */
  87.     Ewl_Child_Show   child_show; /**< Function called on child hide */
  88.     Ewl_Child_Hide   child_hide; /**< Function called on child hide */
  89.  
  90.     Ewl_Container_Iterator iterator; /**< Function to find next child */
  91. };
  92.  
  93. int             ewl_container_init(Ewl_Container *container);
  94.  
  95. void            ewl_container_add_notify_set(Ewl_Container *container,
  96.                          Ewl_Child_Add add);
  97. void            ewl_container_remove_notify_set(Ewl_Container *container,
  98.                             Ewl_Child_Remove remove);
  99. void            ewl_container_resize_notify_set(Ewl_Container *container,
  100.                             Ewl_Child_Resize resize);
  101. void            ewl_container_show_notify_set(Ewl_Container *container,
  102.                           Ewl_Child_Show show);
  103. void            ewl_container_hide_notify_set(Ewl_Container *container,
  104.                           Ewl_Child_Hide show);
  105.  
  106. void            ewl_container_child_append(Ewl_Container *parent,
  107.                        Ewl_Widget *child);
  108. void            ewl_container_child_prepend(Ewl_Container *parent,
  109.                         Ewl_Widget *child);
  110. void            ewl_container_child_insert(Ewl_Container *parent,
  111.                        Ewl_Widget *child, int index);
  112. void        ewl_container_child_insert_internal(Ewl_Container *parent,
  113.                        Ewl_Widget *child, int index);
  114. void            ewl_container_child_remove(Ewl_Container *parent,
  115.                        Ewl_Widget *child);
  116. void            ewl_container_child_resize(Ewl_Widget *w, int size,
  117.                        Ewl_Orientation o);
  118. Ewl_Widget     *ewl_container_child_get(Ewl_Container *parent, int index);
  119. unsigned int    ewl_container_child_index_get(Ewl_Container *parent,
  120.                             Ewl_Widget *child);
  121. void            ewl_container_child_iterate_begin(Ewl_Container *c);
  122. Ewl_Widget     *ewl_container_child_next(Ewl_Container *c);
  123. void            ewl_container_child_iterator_set(Ewl_Container *c,
  124.                          Ewl_Container_Iterator i);
  125. int             ewl_container_child_count_get(Ewl_Container *c);
  126.  
  127. void            ewl_container_destroy(Ewl_Container *c);
  128. void            ewl_container_reset(Ewl_Container *c);
  129. void            ewl_container_callback_notify(Ewl_Container *c,
  130.                           Ewl_Callback_Type t);
  131. void            ewl_container_callback_intercept(Ewl_Container *c,
  132.                           Ewl_Callback_Type t);
  133. void            ewl_container_callback_nointercept(Ewl_Container *c,
  134.                           Ewl_Callback_Type t);
  135. Ewl_Widget     *ewl_container_child_at_get(Ewl_Container *widget, int x,
  136.                                 int y);
  137. Ewl_Widget     *ewl_container_child_at_recursive_get(Ewl_Container *widget,
  138.                              int x, int y);
  139. void            ewl_container_largest_prefer(Ewl_Container *c,
  140.                          Ewl_Orientation o);
  141. void            ewl_container_sum_prefer(Ewl_Container *c, Ewl_Orientation o);
  142.  
  143. void            ewl_container_child_add_call(Ewl_Container *c, Ewl_Widget *w);
  144. void            ewl_container_child_remove_call(Ewl_Container *c, Ewl_Widget *w);
  145. void            ewl_container_child_show_call(Ewl_Container *c, Ewl_Widget *w);
  146. void            ewl_container_child_hide_call(Ewl_Container *c, Ewl_Widget *w);
  147.  
  148. Ewl_Container  *ewl_container_end_redirect_get(Ewl_Container *c);
  149. Ewl_Container  *ewl_container_redirect_get(Ewl_Container *c);
  150. void            ewl_container_redirect_set(Ewl_Container *c, Ewl_Container *rc);
  151.  
  152. /*
  153.  * Internally used callbacks, override at your own risk.
  154.  */
  155. void ewl_container_reveal_cb(Ewl_Widget *w, void *ev_data, void *user_data);
  156. void ewl_container_obscure_cb(Ewl_Widget *w, void *ev_data, void *user_data);
  157. void ewl_container_realize_cb(Ewl_Widget *w, void *ev_data, void *user_data);
  158. void ewl_container_configure_cb(Ewl_Widget * w, void *ev_data, void *user_data);
  159. void ewl_container_reparent_cb(Ewl_Widget * w, void *ev_data, void *user_data);
  160. void ewl_container_unrealize_cb(Ewl_Widget *w, void *ev_data, void *user_data);
  161.  
  162. /**
  163.  * @}
  164.  */
  165.  
  166. #endif                /* __EWL_CONTAINER_H__ */
  167.